﻿@using Smartstore.Web.Models.Customers

@model UserAgreementModel

<div class="page user-agreement-page">
    <div class="page-title">
        <h1>@T("DownloadableProducts.UserAgreement")</h1>
    </div>
    <div class="page-body">
        <div dir="auto">
            @Html.Raw(Model.UserAgreementText)
        </div>
        <div>
            <div class="download-agreement alert alert-info">
                <label for="download-agreement" class="checkbox mb-0">
                    <input id="download-agreement" type="checkbox" value="@T("DownloadableProducts.IAgree")" />
                    @T("DownloadableProducts.IAgree")
                </label>
            </div>
            <button type="submit" id="continue-downloading" class="btn" value="@T("Common.Continue")"
                    onclick="setLocation('@Url.Action("GetDownload", "Download", new { id = Model.OrderItemGuid, agree = true, fileVersion = Model.FileVersion })')">
                <i class="fa fa-check"></i>
                <span>@T("Common.Continue")</span>
            </button>
        </div>
    </div>
</div>

<script sm-target-zone="scripts" data-origin="user-agreement">
    $(function () {
        $("#download-agreement").click(toggleContinueButton);
        toggleContinueButton();
    });

    function toggleContinueButton() {
        if ($('#download-agreement').is(':checked')) {
            $('#continue-downloading').removeAttr('disabled').addClass("btn-info");
        } else {
            $('#continue-downloading').attr('disabled', 'disabled').removeClass("btn-info");
        }
    }
</script>